<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <title>Check Point in Area JSF</title>
        <h:outputStylesheet library="css" name="style.css" />
        <h:outputScript library="javascript" name="lib.js" />
        <h:outputScript library="javascript" name="components.js" />
        <h:outputScript library="javascript" name="LabJSF.js" />
    </h:head>
    <h:body onload="JavaScript: bodyReady('#{form.resource}/images/');">
        <h2>Лабораторная работа #3</h2>
        <a href="/CheckPointInAreaMP/">На главную</a><br />
        <p>Выполнили: <h:outputText value="#{form.authors}"/></p>
        <p>Вариант: <h:outputText value="#{form.variant}"/></p>
        <p>Группа: <h:outputText value="#{form.group}"/></p>
        <div class='container'>
            <h:form id="myForm">
            <div class='form'>                
                <img class='vargr' src='#{form.resource}/images/vargr.png' />
                <div class='form_container'>
                    <p>Выберете точку</p>
                    <div class="component">
                        X:
                        <div class="checkbox-container">
                            <c:forEach items="#{form.xvalues}" varStatus="iterate" var="xValue">
                                <div class="checkbox-item">
                                    <h:selectBooleanCheckbox 
                                        value="#{form.bx[iterate.index].selected}" 
                                        class="setX" 
                                        onclick="JavaScript: clickCheckBoxHandler(this, 'setX');" />
                                    <h:outputText class="setX-title" value="#{xValue}" />
                                </div>
                            </c:forEach>
                        </div>
                    </div>
                    
                    <div class="component">
                        Y:
                        <h:inputText id="y" class="y" value="#{form.y}" 
                                     required="true"
                                     requiredMessage="Значение y не может быть пустой строкой"
                                     converterMessage="Значение y должно быть вещественным числом"
                                     validatorMessage="Значение y должно быть от #{form.ymin} до #{form.ymax}">
                            <f:validateDoubleRange minimum="#{form.ymin}" maximum="#{form.ymax}" />
                        </h:inputText>
                    </div>
                    
                    <div class="component">
                        R:
                        <div class="checkbox-container">
                            <c:forEach items="#{form.rvalues}" var="rValue" varStatus="iterate">
                                <div class="checkbox-item">
                                    <h:selectBooleanCheckbox 
                                        value="#{form.br[iterate.index].selected}" 
                                        class="setR" 
                                        onclick="JavaScript: clickCheckBoxHandler(this, 'setR');" />
                                    <h:outputText class="setR-title" value="#{rValue}" />
                                </div>
                            </c:forEach>
                        </div>
                    </div>
                    
                    <h:commandButton value="Отправить" action="#{form.checkPoint}"  />
                </div>
            </div>
            <div class='result'>
                <p>Валидность</p>
                <div class='valid'>
                    <h:messages />
                </div>
                <p>Ответ от сервера</p>
                <div class='response'>
                    <h:outputText escape="false" id="result" value="#{form.result}"  />
                    <h:outputText escape="false" value="#{form.points}" />
                    <div id="points"></div>
                </div>
            </div>
            </h:form>
        </div>
    </h:body>
</html> 